package android.meetingatsb

import android.content.Intent
import android.meetingatsb.common.Loader
import android.meetingatsb.common.User
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.widget.Button
import android.widget.EditText

class LoginActivity : AppCompatActivity() {
    private lateinit var email: EditText
    private lateinit var password: EditText

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_login)
        bindWidgets()
        setListener()
    }

    private fun setListener() {
        findViewById<Button>(R.id.sign_in).setOnClickListener {
            Loader.saveUser(this, User("HHH", "大学生", "SCUT", 21, "男", 5F))
            intent = Intent(this, MainActivity::class.java)
            startActivity(intent)
        }
    }

    private fun bindWidgets() {
        email = findViewById<EditText>(R.id.login_email)
        password = findViewById<EditText>(R.id.login_password)
    }

}